<?php

/**
 * KTDRegion form.
 *
 * @package    s-test
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class KTDRegionForm extends BaseKTDRegionForm
{
  public function configure()
  {
    $this->setFields();
  }
  public function setFields(){}
}
class BackendKTDRegionForm extends KTDRegionForm{
   public function setFields(){
       $this->setWidget("description", new sfWidgetFormTextarea());
       $this->setWidget("icon", new sfWidgetFormInputFileEditable(array(
               'label' => 'Icône de la région',
               'is_image' => true,
               'file_src' => '/uploads/images/regions/icon/'.$this->getObject()->getIcon(),
               'edit_mode'=> !$this->isNew(),
               'template'  => '%file%<br />%input%<br/>%delete% %delete_label%')));
        $this->setWidget("background", new sfWidgetFormInputFileEditable(array(
               'label' => 'Image de fond de la région',
               'is_image' => true,
               'file_src' => '/uploads/images/regions/background/'.$this->getObject()->getBackground(),
               'edit_mode'=> !$this->isNew(),
               'template'  => '%file%<br />%input%<br/>%delete% %delete_label%')));
       $this->validatorSchema['icon'] = new sfValidatorFile(array(
        'required'   => false,
        'path'       => sfConfig::get('sf_upload_dir').'/images/regions/icon',
        'mime_types' => 'web_images',
       ));
       $this->validatorSchema['background'] = new sfValidatorFile(array(
        'required'   => false,
        'path'       => sfConfig::get('sf_upload_dir').'/images/regions/background',
        'mime_types' => 'web_images',
       ));
       $this->validatorSchema['icon_delete'] = new sfValidatorPass();
       $this->validatorSchema['background_delete'] = new sfValidatorPass();
   }
    
}
